package com.imooc.springcloud;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author caryguan
 * @version V1.0
 * @Package com.imooc.springcloud
 * @date 2020/10/21 14:41
 */

@RestController
@Slf4j
public class Controller {

    @Autowired
    private IService service;

    @GetMapping("/sayHi")//这里需要注解的原因是因为我们是服务调用方,
    public String sayHi(){
        return service.sayHi();
    }


    @PostMapping("/sayHi")//这里需要注解的原因是因为我们是服务调用方,
    public Friend sayHi2(){
        Friend friend = new Friend();
        friend.setName("test");
        return service.sayHiPost(friend);
    }


    @GetMapping("/retry")//这里需要注解的原因是因为我们是服务调用方,
    public String retry(Integer timeout){
        return service.retry(timeout);
    }
}